Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@formatjs/icu-messageformat-parser

Package Overview
Dependencies
Maintainers
0
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/icu-messageformat-parser

Hand-written ICU MessageFormat parser with compatible output as [`intl-messageformat-parser`](https://www.npmjs.com/package/intl-messageformat-parser) but 6 - 10 times as fast.

  • 2.9.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
793K
decreased by-80.29%
Maintainers
0
Weekly downloads
 
Created

What is @formatjs/icu-messageformat-parser?

The @formatjs/icu-messageformat-parser package is a parser for ICU MessageFormat strings, which are used for internationalization and localization. It allows developers to parse complex message strings into an abstract syntax tree (AST) that can be manipulated or used to format messages based on different locales and pluralization rules.

What are @formatjs/icu-messageformat-parser's main functionalities?

Parsing ICU MessageFormat strings

This feature allows you to parse a simple ICU MessageFormat string and obtain an AST representation of it.

import { parse } from '@formatjs/icu-messageformat-parser';
const ast = parse('My name is {name}');

Handling pluralization and select cases

This feature enables parsing of strings with pluralization and select cases, which are essential for proper internationalization.

import { parse } from '@formatjs/icu-messageformat-parser';
const ast = parse('I have {numCats, plural, one {# cat} other {# cats}}');

Support for nested messages

The parser can handle nested messages within an ICU MessageFormat string, allowing for complex message structures.

import { parse } from '@formatjs/icu-messageformat-parser';
const ast = parse('{gender, select, male {He} female {She} other {They}} will respond shortly.');

Argument types parsing

It can parse argument types such as dates and times, which are commonly used in internationalized messages.

import { parse } from '@formatjs/icu-messageformat-parser';
const ast = parse('The event starts on {startDate, date, long}');

Other packages similar to @formatjs/icu-messageformat-parser

FAQs

Package last updated on 04 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc